WIP: SWTBot test case: ESP-IDF Manager Editor verification#1491
WIP: SWTBot test case: ESP-IDF Manager Editor verification#1491AndriiFilippov wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe test suite adds platform-specific ESP-IDF tools-path configuration and a new SWTBot test covering the ESP-IDF Manager editor, environment refresh completion, and consistency between active installation details and C/C++ build environment variables. ChangesESP-IDF Manager UI coverage
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant EspIdfManagerTest
participant IDE
participant ESP-IDF Manager
participant Console
participant Preferences
EspIdfManagerTest->>IDE: Open ESP-IDF Manager
IDE->>ESP-IDF Manager: Display installed versions
EspIdfManagerTest->>ESP-IDF Manager: Refresh environment
ESP-IDF Manager->>Console: Report tools setup
Console-->>EspIdfManagerTest: Return setup markers
EspIdfManagerTest->>Preferences: Open build environment
Preferences-->>EspIdfManagerTest: Return IDF variables
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/com.espressif.idf.ui.test/configs/default-test-linux.properties`:
- Around line 16-18: The default-test-linux configuration currently overrides
the documented local tools path with a value derived from an unset
GITHUB_WORKSPACE. Update DefaultPropertyFetcher to apply this CI-only path only
when GITHUB_WORKSPACE is set, otherwise preserve the existing ~/.espressif/tools
fallback; alternatively, remove or conditionally exclude this property for local
Linux execution.
In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java`:
- Around line 177-201: Update thenToolsSetupCompletesInConsole and its setup
flow to track the current console run rather than relying on
toolsSetupCompleteCountBeforeAction across console clears. After refresh opens
or clears the tools console, wait for the new “Setting up IDE environment” and
“Tools Setup complete” messages in that run, preserving the existing completion
wait behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fb7b2b71-9654-469f-a8a5-3cee1fb8eed2
📒 Files selected for processing (3)
tests/com.espressif.idf.ui.test/configs/default-test-linux.propertiestests/com.espressif.idf.ui.test/configs/default-test-win.propertiestests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java
| # ESP-IDF tools installation directory used by EspIdfManagerTest | ||
| # Linux CI uses GITHUB_WORKSPACE placeholder; local Linux default is ~/.espressif/tools | ||
| default.env.idf.tools.path={0}/dependencies/idf-tools |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve the local tools-path fallback.
When GITHUB_WORKSPACE is unset, DefaultPropertyFetcher expands this to null/dependencies/idf-tools rather than the documented ~/.espressif/tools. Handle the missing environment variable in the fetcher or avoid applying this CI-only property locally.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/com.espressif.idf.ui.test/configs/default-test-linux.properties` around
lines 16 - 18, The default-test-linux configuration currently overrides the
documented local tools path with a value derived from an unset GITHUB_WORKSPACE.
Update DefaultPropertyFetcher to apply this CI-only path only when
GITHUB_WORKSPACE is set, otherwise preserve the existing ~/.espressif/tools
fallback; alternatively, remove or conditionally exclude this property for local
Linux execution.
| toolsSetupCompleteCountBeforeAction = countOccurrences(getConsoleText(toolsConsole), | ||
| TOOLS_SETUP_COMPLETE); | ||
|
|
||
| SWTBotButton refreshButton = editor.bot().button(REFRESH_ENVIRONMENT_BUTTON); | ||
| assertTrue("Refresh Environment must be enabled before clicking it", refreshButton.isEnabled()); //$NON-NLS-1$ | ||
| refreshButton.click(); | ||
|
|
||
| waitForToolsSetupToStart(editor, toolsConsole, REFRESH_ENVIRONMENT_BUTTON); | ||
| } | ||
|
|
||
| static void thenToolsSetupCompletesInConsole() | ||
| { | ||
| SWTBotView toolsConsole = ProjectTestOperations.viewConsole(TOOLS_CONSOLE_NAME, bot); | ||
| toolsConsole.show(); | ||
| toolsConsole.setFocus(); | ||
|
|
||
| final int expectedMinimumCount = toolsSetupCompleteCountBeforeAction + 1; | ||
| toolsConsole.bot().waitUntil(new DefaultCondition() | ||
| { | ||
| @Override | ||
| public boolean test() throws Exception | ||
| { | ||
| String consoleText = getConsoleText(toolsConsole); | ||
| return countOccurrences(consoleText, TOOLS_SETUP_COMPLETE) >= expectedMinimumCount | ||
| && consoleText.contains(SETTING_UP_IDE_ENVIRONMENT); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n -C4 'clearConsole|TOOLS_SETUP_COMPLETE|Tools Setup complete|Setting up IDE environment' \
--type java tests bundlesRepository: espressif/idf-eclipse-plugin
Length of output: 12665
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- IDFConsole.java ---'
sed -n '1,120p' bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java
echo
echo '--- SetupToolsInIde.java (setup logging) ---'
sed -n '130,175p' bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/SetupToolsInIde.java
echo
echo '--- EspIdfManagerTest.java around refresh/wait helpers ---'
sed -n '150,230p' tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java
echo
echo '--- EspIdfManagerTest.java around related console assertions ---'
sed -n '340,390p' tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.javaRepository: espressif/idf-eclipse-plugin
Length of output: 9279
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- Refresh-related references ---'
rg -n -C3 'Refresh Environment|refresh.*environment|setupTools|Tools Console|createToolsConsole|clearConsole\(' \
bundles tests -g '*.java'
echo
echo '--- EspIdfManagerTest.java full helper area ---'
sed -n '1,260p' tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java
echo
echo '--- IDFConsole.java full file ---'
sed -n '1,220p' bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.javaRepository: espressif/idf-eclipse-plugin
Length of output: 31985
Track the new console run instead of counting across clears: IDFConsole.getConsoleStream(...) clears Espressif IDF Tools Console before every setup, so toolsSetupCompleteCountBeforeAction + 1 can be impossible once refresh starts from a cleared console. Wait for the new Setting up IDE environment / Tools Setup complete pair in the current run, or reset the baseline after the refresh job opens the console.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java`
around lines 177 - 201, Update thenToolsSetupCompletesInConsole and its setup
flow to track the current console run rather than relying on
toolsSetupCompleteCountBeforeAction across console clears. After refresh opens
or clears the tools console, wait for the new “Setting up IDE environment” and
“Tools Setup complete” messages in that run, preserving the existing completion
wait behavior.
Description
Please include a summary of the change and which issue is fixed.
Fixes # (IEP-1796)
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Dependent components impacted by this PR:
Checklist
Summary by CodeRabbit